part of _;

extension on RegisterPage {
  Widget view_topBar() {
    return YButton(
      width: yNavBarHeight(),
      height: yNavBarHeight(),
      margin: EdgeInsets.only(top: yStatubarHeight()),
      child: Icon(Icons.close),
      onTap: () => yFinish(),
    );
  }

  Widget view_title() {
    return Row(
      children: [
        Text("已有账户？", style: TextStyle(color: Colors.grey)),
        GestureDetector(
          child: Text("立即登录", style: TextStyle(color: YConfig.themeColor)),
          onTap: () => yIntent(LoginPage(), intentType: YIntentType.Present_Replace),
        ),
      ],
    );
  }

  Widget view_protocol() {
    return GestureDetector(
      onTap: () => setState(() => isSelectProtocol = !isSelectProtocol),
      child: Row(
        children: [
          Checkbox(value: isSelectProtocol, onChanged: (value) => setState(() => isSelectProtocol = value!)),
          MyViews.view_protocol(yPage),
        ],
      ),
    );
  }

  Widget view_main() {
    return Column(
      children: [
        TextFormField(
          controller: textController_loginname,
          decoration: InputDecoration(
            hintText: hint_loginname,
            hintStyle: TextStyle(color: Colors.grey),
            enabledBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.grey.shade400)),
          ),
          focusNode: focusNode_loginname,
        ),
        YSpacer(height: 20),
        TextFormField(
          controller: textController_password1,
          obscureText: !isShowPassword,
          decoration: InputDecoration(
            hintText: hint_password1,
            hintStyle: TextStyle(color: Colors.grey),
            enabledBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.grey.shade400)),
            suffixIcon: YButton(
              width: 50,
              child: Image.asset(isShowPassword ? "images/ic_eye_open.png" : "images/ic_eye_close.png", width: 20),
              onTap: () => setState(() => isShowPassword = !isShowPassword),
            ),
          ),
        ),
        YSpacer(height: 20),
        TextFormField(
          controller: textController_password2,
          obscureText: !isShowPassword,
          decoration: InputDecoration(
            hintText: hint_password2,
            hintStyle: TextStyle(color: Colors.grey),
            enabledBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.grey.shade400)),
            suffixIcon: YButton(
              width: 50,
              child: Image.asset(isShowPassword ? "images/ic_eye_open.png" : "images/ic_eye_close.png", width: 20),
              onTap: () => setState(() => isShowPassword = !isShowPassword),
            ),
          ),
        ),
        YSpacer(height: 20),
        TextFormField(
          controller: textController_code,
          decoration: InputDecoration(
            hintText: hint_code,
            hintStyle: TextStyle(color: Colors.grey),
            enabledBorder: UnderlineInputBorder(borderSide: BorderSide(color: Colors.grey.shade400)),
            suffixIcon: codeParams == null || codeParams!.isEmpty
                ? YEmpty()
                : GestureDetector(
                    child: Container(
                      padding: EdgeInsets.all(5),
                      child: YImage(null, 0, "${IFinal.Others.BaseIP}${IFinal.Urls.verifyCode}$codeParams"),
                    ),
                    onTap: () => controller_refreshCode(),
                  ),
          ),
        ),
        YSpacer(height: 30),
        YButton(
          width: yScreenSize().width,
          height: 50,
          borderRadius: BorderRadius.circular(99),
          decoration: BoxDecoration(gradient: IFinal.Colors.btnThemeGradient),
          child: Text("注册", style: TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold)),
          onTap: () => controller_register(),
        ),
      ],
    );
  }
}
